<?php
/*
 * @Author: 李志刚
 * @CopyRight: 2020-2030 衡水山木枝技术服务有限公司
 * @Date: 2021-10-19 10:14:30
 * @Description: 商品基础表
 * @LastEditors: 李志刚
 * @LastEditTime: 2021-10-20 09:10:00
 * @FilePath: /归档/base/2021_10_19_101430_create_good.php
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateGoods extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->id();
            $table->foreignId('shop_id');
            $table->integer('brand_id')->default(0)->comment('品牌ID');
            $table->string('title', 255)->default('')->comment('商品标题');
            $table->string('thumb', 255)->default('')->comment('商品封面图');
            $table->text('album')->default('')->nullable()->comment('图集');
            $table->text('describe')->default('')->comment('简介');
            $table->text('content')->default('')->comment('详情');
            $table->unsignedDecimal('market_price')->default(0)->comment('市场价');
            $table->unsignedDecimal('shop_price')->default(0)->comment('店铺价格');
            $table->unsignedInteger('store')->default(0)->comment('库存');
            $table->unsignedInteger('sales')->default(0)->comment('销量');
            $table->dateTime('lasttime')->default('2021-10-10 00:00:00')->comment('上架时间');
            $table->dateTime('lowertime')->default('2021-10-10 00:00:00')->comment('下架时间');
            $table->integer('sort')->default(0)->comment('排序 升序');
            $table->integer('shop_sort')->default(0)->comment('商家排序');
            $table->tinyInteger('is_pos')->default(0)->comment('是否推荐，0否');
            $table->tinyInteger('is_hot')->default(0)->comment('是否推荐，0否');
            $table->tinyInteger('is_new')->default(0)->comment('是否推荐，0否');
            $table->tinyInteger('prom_type')->default(0)->comment('0普通商品，1限时，2团购，3满赠，4活动');
            $table->integer('prom_id')->default(0)->comment('优惠活动ID');
            $table->boolean('status')->default(1)->comment('1 在售，0 下架');
            $table->tinyInteger('del_flag')->default(0)->comment('删除状态（1删除 0正常）');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods');
    }
}
